<?php

namespace oa\controllers;

use Yii;
use oa\services\UserService;

class PublicController extends BaseController
{
    public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        if ($this->request->isPost) {
            $res = UserService::login();
            if ($res === true) {
                return $this->ok('登录成功');
            }
            return $this->err($res);
        }
        $this->layout = false;
        return $this->fetch();
    }

    public function actionSeekPassword()
    {
        return $this->fetch();
    }

    public function actionSendVerifycode()
    {
        
    }

    public function actionBox()
    {
//         for ($i=387; $i<388; $i++) {
//             $id ='20220523220523239A0' . $i;
//             $sql = "INSERT INTO ebcproductioncode(Id,AddBy,AddTime,EditBy,EditTime,BatchCode,CodeLevel,CodePath,Count,
// FactoryId,IsRunning,LineId,MaterialId,MinSaleUnit,PackDate,ParentCode,PrintDate,RootCode,Sequence,ShouldOrgId,ShouldOrgType,ValidDate)
// VALUES
// ('{$id}','hpp','2022-06-11 08:00:00.000','hpp','2022-06-11 08:00:00.000','220523239A',2,'33079,',1,
// '9e0c70cc-a631-4408-8daf-529cbb629e95',0,1,'24ba45d9-c51e-44ec-83d2-89cf840c815e',1,'2021-05-23 00:00:00.000','33079',
// '2022-04-01 00:00:00.000','33079',1,'a55a3fb6-7a4a-4a03-88ed-79390c9fae3c',3,'2023-11-23 00:00:00.000');";
//             Yii::$app->db_yisu2->createCommand($sql)->execute();
//         }

    }
}
